package com.aspose.cells;

class zbqo extends zbz {
   private Style a = null;
   private long d = 0L;
   private int e = 32774;

   zbqo(Style var1) {
      this.c(244);
      this.a = var1;
      if (var1 != null) {
         this.a();
      }

   }

   private void a() {
      int var1 = 6;
      if (this.a.isModified(24)) {
         String var2 = this.a.getCustom();
         if (var2 != null && var2.length() > 0) {
            this.e |= 1;
            var1 += 4 + zakq.e(var2);
         } else {
            var1 += 2;
         }

         this.d |= 33554432L;
      }

      if (this.a.isModified(11)) {
         this.d |= 67108864L;
         var1 += 118;
      }

      if (this.a.isModified(38)) {
         this.d |= 134217728L;
         var1 += 8;
      }

      if (this.a.isModified(1)) {
         this.d |= 268435456L;
         var1 += 8;
      }

      if (this.a.isModified(32)) {
         this.d |= 536870912L;
         var1 += 4;
      }

      if (this.a.isModified(36)) {
         this.d |= 1073741824L;
         var1 += 2;
      }

      this.a((short)var1);
      this.c = new byte[this.d()];
      this.b();
   }

   private void b() {
      int var1 = 6;
      int var4;
      if (this.a.isModified(24)) {
         String var2 = this.a.getCustom();
         if (var2 != null && var2.length() > 0) {
            var1 += 2;
            int[] var3 = new int[]{var1};
            var4 = zco.a(this.c, var3, var2);
            var1 = var3[0];
            System.arraycopy(com.aspose.cells.b.a.zc.a((short)(var4 + 2)), 0, this.c, 6, 2);
         } else {
            this.c[var1++] = 0;
            this.c[var1++] = (byte)this.a.getNumber();
         }
      }

      int var7;
      byte var9;
      if (this.a.isModified(11)) {
         for(var7 = 0; var7 < 64; ++var7) {
            this.c[var1 + var7] = 0;
         }

         if (this.a.isModified(13)) {
            var7 = zco.a(this.c, var1 + 1, this.a.getFont().getName());
            this.c[var1] = (byte)var7;
         }

         if (this.a.isModified(12)) {
            System.arraycopy(com.aspose.cells.b.a.zc.a(this.a.getFont().getSize() * 20), 0, this.c, var1 + 64, 4);
         } else {
            System.arraycopy(com.aspose.cells.b.a.zc.a((int)-1), 0, this.c, var1 + 64, 4);
         }

         if (this.a.isModified(18)) {
            if (this.a.getFont().isItalic()) {
               this.c[var1 + 68] = (byte)(this.c[var1 + 68] | 2);
            }
         } else {
            this.c[var1 + 88] = (byte)(this.c[var1 + 88] | 2);
         }

         if (this.a.isModified(17)) {
            System.arraycopy(com.aspose.cells.b.a.zc.a(this.a.getFont().g()), 0, this.c, var1 + 72, 2);
         } else {
            System.arraycopy(com.aspose.cells.b.a.zc.a((int)1), 0, this.c, var1 + 100, 4);
         }

         if (this.a.isModified(20)) {
            if (this.a.getFont().isStrikeout()) {
               this.c[var1 + 68] = (byte)(this.c[var1 + 68] | 128);
            }
         } else {
            this.c[var1 + 88] = (byte)(this.c[var1 + 88] | 128);
         }

         if (this.a.isModified(23)) {
            var9 = 1;
            if (this.a.getFont().isSubscript()) {
               var9 = 2;
            }

            System.arraycopy(com.aspose.cells.b.a.zc.a((short)var9), 0, this.c, var1 + 74, 2);
         } else {
            System.arraycopy(com.aspose.cells.b.a.zc.a((int)1), 0, this.c, var1 + 92, 4);
         }

         if (this.a.isModified(19)) {
            var9 = 0;
            switch(this.a.getFont().getUnderline()) {
            case 1:
               var9 = 1;
               break;
            case 2:
               var9 = 2;
               break;
            case 3:
               var9 = 33;
               break;
            case 4:
               var9 = 34;
            }

            this.c[var1 + 76] = var9;
         } else {
            System.arraycopy(com.aspose.cells.b.a.zc.a((int)1), 0, this.c, var1 + 96, 4);
         }

         var7 = -1;
         if (this.a.isModified(16)) {
            var7 = this.a.a((zakp)this.a.getFont().b, (int)32767);
         }

         System.arraycopy(com.aspose.cells.b.a.zc.a(var7), 0, this.c, var1 + 80, 4);
         System.arraycopy(com.aspose.cells.b.a.zc.a((short)1), 0, this.c, var1 + 116, 2);
         var1 += 118;
      }

      if (this.a.isModified(38)) {
         if (this.a.isModified(25)) {
            this.c[var1] |= (byte)zsk.b(this.a.getHorizontalAlignment(), false);
         } else {
            this.d |= 1L;
         }

         if (this.a.isModified(26)) {
            this.c[var1] |= (byte)(zsk.b(this.a.getVerticalAlignment(), true) << 4);
         } else {
            this.d |= 2L;
         }

         if (this.a.isModified(29)) {
            if (this.a.isTextWrapped()) {
               this.c[var1] = (byte)(this.c[var1] | 8);
            }
         } else {
            this.d |= 4L;
         }

         if (this.a.isModified(28)) {
            this.c[var1 + 1] = (byte)this.a.getRotationAngle();
         } else {
            this.d |= 8L;
         }

         this.d |= 16L;
         if (this.a.isModified(27)) {
            if (this.a.getIndentLevel() <= 15) {
               this.c[var1 + 2] |= (byte)this.a.getIndentLevel();
               this.c[var1 + 4] = -1;
            } else {
               this.c[var1 + 4] = (byte)this.a.getIndentLevel();
            }
         } else {
            this.d |= 32L;
         }

         if (this.a.isModified(30)) {
            if (this.a.getShrinkToFit()) {
               this.c[var1 + 2] = (byte)(this.c[var1 + 2] | 16);
            }
         } else {
            this.d |= 64L;
         }

         this.d |= 128L;
         if (this.a.isModified(31)) {
            var9 = 0;
            switch(this.a.getTextDirection()) {
            case 1:
               var9 = 1;
               break;
            case 2:
               var9 = 2;
            }

            this.c[var1 + 2] |= (byte)((var9 & 255) << 6);
         } else {
            this.d |= 2147483648L;
         }

         var1 += 8;
      }

      int var8;
      if (this.a.isModified(1)) {
         if (this.a.getBorders().a) {
            this.e |= 4;
         }

         var7 = 0;
         var8 = 0;
         long var10 = 0L;
         boolean var6 = true;
         int var11;
         if (this.a.isModified(2)) {
            var7 |= this.a.getBorders().getByBorderType(1).getLineStyle();
            var11 = this.a.a((zakp)this.a.getBorders().getByBorderType(1).a, (int)64);
            var8 |= var11;
         } else {
            this.d |= 1024L;
         }

         if (this.a.isModified(3)) {
            var7 |= this.a.getBorders().getByBorderType(2).getLineStyle() << 4;
            var11 = this.a.a((zakp)this.a.getBorders().getByBorderType(2).a, (int)64);
            var8 |= var11 << 7;
         } else {
            this.d |= 2048L;
         }

         if (this.a.isModified(4)) {
            var7 |= this.a.getBorders().getByBorderType(4).getLineStyle() << 8;
            var11 = this.a.a((zakp)this.a.getBorders().getByBorderType(4).a, (int)64);
            var10 |= (long)var11;
         } else {
            this.d |= 4096L;
         }

         if (this.a.isModified(5)) {
            var7 |= this.a.getBorders().getByBorderType(8).getLineStyle() << 12;
            var11 = this.a.a((zakp)this.a.getBorders().getByBorderType(8).a, (int)64);
            var10 |= (long)(var11 << 7);
         } else {
            this.d |= 8192L;
         }

         if (this.a.isModified(9)) {
            var8 |= 16384;
            var10 |= (long)(this.a.getBorders().getByBorderType(16).getLineStyle() << 21);
            var11 = this.a.a((zakp)this.a.getBorders().getByBorderType(16).a, (int)64);
            var10 |= (long)(var11 << 14);
         } else {
            this.d |= 16384L;
         }

         if (this.a.isModified(10)) {
            var8 |= 32768;
            var10 |= (long)(this.a.getBorders().getByBorderType(32).getLineStyle() << 21);
            var11 = this.a.a((zakp)this.a.getBorders().getByBorderType(32).a, (int)64);
            var10 |= (long)(var11 << 14);
         } else {
            this.d |= 32768L;
         }

         System.arraycopy(com.aspose.cells.b.a.zc.a(var7), 0, this.c, var1, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var8), 0, this.c, var1 + 2, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var10), 0, this.c, var1 + 4, 4);
         var1 += 8;
      }

      if (this.a.isModified(32)) {
         var7 = 0;
         var8 = 0;
         if (this.a.isModified(33)) {
            var7 |= this.a.getPattern() << 10;
         } else {
            this.d |= 65536L;
         }

         System.arraycopy(com.aspose.cells.b.a.zc.a((short)var7), 0, this.c, var1, 2);
         boolean var12 = true;
         if (this.a.isModified(34)) {
            var4 = this.a.a((zakp)this.a.b, (int)64);
            var8 |= var4;
         } else {
            this.d |= 131072L;
         }

         if (this.a.isModified(35)) {
            var4 = this.a.a((zakp)this.a.a, (int)65);
            var8 |= var4 << 7;
         } else {
            this.d |= 262144L;
         }

         System.arraycopy(com.aspose.cells.b.a.zc.a((short)var8), 0, this.c, var1 + 2, 2);
         var1 += 4;
      }

      if (this.a.o()) {
         if (this.a.isModified(36)) {
            if (this.a.isLocked()) {
               this.c[var1] = (byte)(this.c[var1] | 1);
            }
         } else {
            this.d |= 256L;
         }

         if (this.a.isModified(37)) {
            if (this.a.isFormulaHidden()) {
               this.c[var1] = (byte)(this.c[var1] | 2);
            }
         } else {
            this.d |= 512L;
         }

         var1 += 2;
      }

      System.arraycopy(com.aspose.cells.b.a.zc.a(this.d), 0, this.c, 0, 4);
      System.arraycopy(com.aspose.cells.b.a.zc.a(this.e), 0, this.c, 4, 2);
   }
}
